# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>

pkgname=gnome-settings-daemon
pkgver=3.30.1.2
pkgrel=1
pkgdesc="GNOME Settings Daemon"
url="https://gitlab.gnome.org/GNOME/gnome-settings-daemon"
arch=(x86_64)
license=(GPL)
depends=(dconf gnome-desktop gsettings-desktop-schemas libcanberra-pulse libnotify libsystemd
         libwacom pulseaudio pulseaudio-alsa upower librsvg libgweather geocode-glib geoclue2 nss
         libgudev gtk3-print-backends libnm)
makedepends=(xf86-input-wacom libxslt docbook-xsl python git meson)
checkdepends=(python-pip python-gobject python-dbus)
groups=(gnome)
_commit=0e5951b4201d2363221d1ddf319fcd313ee39b28  # tags/GNOME_SETTINGS_DAEMON_3_30_1_2^0
source=("git+https://gitlab.gnome.org/GNOME/gnome-settings-daemon.git#commit=$_commit"
        "git+https://gitlab.gnome.org/GNOME/libgnome-volume-control.git")
sha256sums=('SKIP'
            'SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^GNOME_SETTINGS_DAEMON_//;s/_/./g;s/-/+/g'
}

prepare() {
  cd $pkgname

  git submodule init
  git config --local submodule.subprojects/gvc.url "$srcdir/libgnome-volume-control"
  git submodule update
}

build() {
  arch-meson $pkgname build
  ninja -C build
}

check() {
  python -m venv --system-site-packages venv
  venv/bin/pip install python-dbusmock
  sed -i "1s|/usr/bin/python3|$srcdir/venv/bin/python|" $pkgname/plugins/*/test.py
  meson test -C build
}

package() {
  DESTDIR="$pkgdir" meson install -C build
}
